home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / cbibcode.arc / FGETCHAR.C < prev    next >
Encoding:
C/C++ Source or Header  |  1991-08-05  |  324 b   |  16 lines

  1. /* fgetchar.c */
  2. #include <stdio.h>
  3. main()
  4. {
  5.     int i, c;
  6.     char buffer[81];
  7.     printf("Enter a line (end with a return):\n");
  8.     c= fgetchar();
  9.     for (i=0; (i<80) && (c != '\n'); i++)
  10.     {
  11.        buffer[i] = c;
  12.        c= fgetchar();
  13.     }
  14.     buffer[i] = '\0';        /* Make a C-style string */
  15.     printf("You entered: %s\n", buffer);
  16. }